package com.erp.dto;

import com.erp.domain.TPrivilege;

public class Privilege implements java.io.Serializable {

	private static final long serialVersionUID = 1L;

	public Privilege() {
	}

	/**
	 * 将持久化对象转化为数据传输对象
	 * 
	 * @param privilege
	 */
	public Privilege(TPrivilege tPrivilege) {
		this.id = tPrivilege.getId();
		this.name = tPrivilege.getName();
		this.url = tPrivilege.getUrl();
		this.description = tPrivilege.getDescription();
		this.orderNumber = tPrivilege.getOrderNumber();
		this.level = tPrivilege.getLevel();
		TPrivilege parent = tPrivilege.getParent();
		if (parent != null) {
			this.parentId = parent.getId();
		}

	}

	private Integer id;
	private String name;
	private String url;
	private String description;
	private Integer orderNumber;
	private Integer level;
	private Integer parentId;

	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public Integer getOrderNumber() {
		return orderNumber;
	}

	public void setOrderNumber(Integer orderNumber) {
		this.orderNumber = orderNumber;
	}

	public Integer getLevel() {
		return level;
	}

	public void setLevel(Integer level) {
		this.level = level;
	}

	public Integer getParentId() {
		return parentId;
	}

	public void setParentId(Integer parentId) {
		this.parentId = parentId;
	}

	@Override
	public boolean equals(Object obj) {
		if (this.id.intValue() == ((Privilege) obj).getId().intValue()) {
			return true;
		} else
			return false;
	}

}
